Workaround buggy GCCs wrt strftime.
authorEwan Mellor <ewan@xensource.com>
Fri, 23 Mar 2007 17:51:24 +0000 (17:51 +0000)
committerEwan Mellor <ewan@xensource.com>
Fri, 23 Mar 2007 17:51:24 +0000 (17:51 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/libxen/test/test_bindings.c

index c709e64867b341b08c935a7d7661d78d21e8a2ae..922518fe8a9cf253aa63ad6c1bada01f888d16aa 100644 (file)
@@ -572,6 +572,16 @@ static void print_vm_power_state(xen_session *session, xen_vm vm)
 }
 
 
+/**
+ * Workaround for whinging GCCs, as suggested by strftime(3).
+ */
+static size_t my_strftime(char *s, size_t max, const char *fmt,
+                          const struct tm *tm)
+{
+    return strftime(s, max, fmt, tm);
+}
+
+
 /**
  * Print the metrics for the given VM.
  */
@@ -594,7 +604,7 @@ static void print_vm_metrics(xen_session *session, xen_vm vm)
 
     char time[256];
     struct tm *tm = localtime(&vm_metrics_record->last_updated);
-    strftime(time, 256, "Metrics updated at %c, local time.\n", tm);
+    my_strftime(time, 256, "Metrics updated at %c, local time.\n", tm);
     printf(time);
 
     for (size_t i = 0; i < vm_metrics_record->vcpus_utilisation->size; i++)